home *** CD-ROM | disk | FTP | other *** search
/ BCI NET / BCI NET Dec 94.iso / archives / programming / blitzbasic / blitz-list200994.lha / blitz-list / 000189_blitz-list-request_Tue Aug 9 18:35:39 1994.msg < prev    next >
Internet Message Format  |  1994-09-20  |  3KB

  1. Received: from sisvax (sisvax.sis.port.ac.uk [148.197.159.14]) by kantti.helsinki.fi (8.6.9/8.6.5) with SMTP id SAA00555 for <blitz-list@helsinki.fi>; Tue, 9 Aug 1994 18:35:12 +0300
  2. Date: Tue, 9 Aug 1994 16:35:53 +0100
  3. Message-Id: <94080916355327@sisvax.sis.port.ac.uk>
  4. From: sis3147@sisvax.sis.port.ac.uk (Big Will Riker)
  5. To: blitz-list@helsinki.fi
  6. X-VMS-To: BLITZLIST
  7. MIME-Version: 1.0
  8. Content-Type: text/plain; charset="us-ascii"
  9. Content-Transfer-Encoding: 7bit
  10. X-Status: 
  11. Status: RO
  12.  
  13. Here's a coupla statements which may prove useful to all you brilliant
  14. Blitz coders out there.
  15. Basically it performs the ColSplit command but on AGA displays.
  16. Don't ask me why you need a display x2 as high, perhaps its AGA being
  17. crummy. Perhaps its me being crummy. Anyway, enough of this crap.
  18. Here it is.....
  19.  
  20.  
  21. NEWTYPE .rgbcomp                ; Cos blitz cant
  22.   r.w                        ; pass >6 params
  23.   g.w
  24.   b.w
  25. END NEWTYPE
  26.  
  27. DEFTYPE .rgbcomp agacolour1,agacolour2        ; Start and End cols
  28.  
  29.  
  30. ; Pass the coplist number
  31. ; Plus y-start, y-end and a colour number
  32. Statement AGAColSplit {clist.l,y1.w,y2.w,colnum.w}
  33.   SHARED agacolour1,agacolour2
  34.   r1.w=agacolour1\r
  35.   g1.w=agacolour1\g
  36.   b1.w=agacolour1\b
  37.   r2.w=agacolour2\r
  38.   g2.w=agacolour2\g
  39.   b2.w=agacolour2\b
  40.   rs.q=((r2-r1)/(y2-y1))
  41.   gs.q=((g2-g1)/(y2-y1))
  42.   bs.q=((b2-b1)/(y2-y1))        ; Calculate step values
  43.   rc.q=r1
  44.   gc.q=g1
  45.   bc.q=b1
  46.   PaletteInfo 0                ; Needed to get AGAPalRed etc
  47.   ro.w=AGAPalRed(colnum)
  48.   go.w=AGAPalGreen(colnum)
  49.   bo.w=AGAPalBlue(colnum)        ; Store the old values
  50.   For h.w=y1 To y2            
  51.      AGAPalRGB 0,colnum,Int(rc),Int(gc),Int(bc)
  52.      CustomColors clist,8*(h-y1),h,0,colnum,1    ; Dont ask me how...
  53.      rc+rs        ; Each instruction is 8 bytes (we hope)
  54.      gc+gs
  55.      bc+bs
  56.   Next h
  57.   AGAPalRGB 0,0,ro,go,bo            ; Restore the originals
  58. End Statement
  59.  
  60. Function.l CCSize {height.l}            ; Used to calc
  61.   Function Return height*8            ; Size of CustomCop instructions
  62. End Function
  63.  
  64. .e.g
  65.  
  66.     InitCopList  0,44,256*2,$10008,8,256,CCSize{256}
  67. ;The last parameter allocates memory for Custom copperlist instructions
  68. ;which (with no thanks to ACID) is used by CustomColors.
  69.  
  70. ; for some unkown reason, we need to create the display twice as high
  71. ; but makes no difference to the display though
  72.     agacolour1\r=0
  73.     agacolour1\g=0
  74.     agacolour1\b=0
  75.     agacolour2\r=255
  76.     agacolour2\g=255
  77.     agacolour2\b=255
  78.     AGAColSplit{0,0,255,0}        ; Use coplist 0, from 0 to 255
  79.                     ; using colour 0
  80.     CreateDisplay 0
  81.  
  82. And there you go! Try it out and let us know if it works or not.
  83.